package singles

import (
	"github.com/go-resty/resty/v2"
	"showurl/static-file/kplayer/apis/config"
	httpUtils "showurl/static-file/kplayer/apis/utils/http"
)

type RespGetStatus struct {
	Status         string `json:"status"`
	AutoConnection bool   `json:"auto_connection"`
	CacheUse       bool   `json:"cache_use"`
	CachePath      string `json:"cache_path"`
	NextIndex      int    `json:"next_index"`
	LoopCount      int    `json:"loop_count"`
}

func GetStatus() *RespGetStatus {
	resp := &RespGetStatus{}
	httpUtils.ParseResponseJsonBody(func(r *resty.Request) (*resty.Response, error) {
		return r.Get(config.Host + `/v1.1/player/status`)
	}, resp)
	return resp
}
/*
{
    "status": "PLAYING",
    "auto_connection": true,
    "cache_use": true,
    "cache_path": "/root/movie1/cache",
    "next_index": 29,
    "loop_count": 0
}
 */